<html>
    <head>
        <title>配置</title>
    </head>
    <body>
        <script>
              /*
                        二、配置


                             1、如何配置Swagger

                                        首先，我们需要使用AddAbpSwaggerGen扩展在我们模块的ConfigureServices方法中配置Swagger：


                                                    public override void ConfigureServices(ServiceConfigurationContext context)
                                                    {
                                                        var services = context.Services;

                                                        //... other configurations.

                                                        services.AddAbpSwaggerGen(
                                                            options =>
                                                            {
                                                                options.SwaggerDoc("v1", new OpenApiInfo { Title = "Test API", Version = "v1" });
                                                                options.DocInclusionPredicate((docName, description) => true);
                                                                options.CustomSchemaIds(type => type.FullName);
                                                            }
                                                        );
                                                    }

                            2、使用Swagger中间件

                                            然后我们可以通过调用模块的OnApplicationInitialization方法中的UseAbpSwaggerUI方法来使用Swagger UI：

                                                        public override void OnApplicationInitialization(ApplicationInitializationContext context)
                                                        {
                                                            var app = context.GetApplicationBuilder();

                                                            //... other configurations.

                                                            app.UseStaticFiles();

                                                            app.UseSwagger();  // 使用Swagger中间件

                                                            app.UseAbpSwaggerUI(options =>
                                                            {
                                                                options.SwaggerEndpoint("/swagger/v1/swagger.json", "Test API");
                                                            });
                                                            
                                                            //... other configurations.
                                                        }


                                3、 如何在Swagger UI上隐藏ABP端点

                                              如果要隐藏ABP的默认端点，请在Swagger配置中调用HideAbpEndpoints方法，如以下示例所示：

                                                        services.AddAbpSwaggerGen(
                                                            options => 
                                                            {
                                                                //... other options
                                                                
                                                                //Hides ABP Related endpoints on Swagger UI
                                                                options.HideAbpEndpoints();
                                                            }
                                                        )
                   */

        </script>
    </body>
</html>